﻿using System;
using Microsoft.Xna.Framework;

namespace Terraria.UI
{
	// Token: 0x02000115 RID: 277
	public class SnapPoint
	{
		// Token: 0x170000D7 RID: 215
		// (get) Token: 0x06000C30 RID: 3120 RVA: 0x0000C787 File Offset: 0x0000A987
		public string Name
		{
			get
			{
				return this._name;
			}
		}

		// Token: 0x170000D8 RID: 216
		// (get) Token: 0x06000C31 RID: 3121 RVA: 0x0000C78F File Offset: 0x0000A98F
		public int ID
		{
			get
			{
				return this._id;
			}
		}

		// Token: 0x170000D9 RID: 217
		// (get) Token: 0x06000C32 RID: 3122 RVA: 0x0000C797 File Offset: 0x0000A997
		public Vector2 Position
		{
			get
			{
				return this._calculatedPosition;
			}
		}

		// Token: 0x06000C33 RID: 3123 RVA: 0x0000C79F File Offset: 0x0000A99F
		public SnapPoint(string name, int id, Vector2 anchor, Vector2 offset)
		{
			this._name = name;
			this._id = id;
			this._anchor = anchor;
			this._offset = offset;
		}

		// Token: 0x06000C34 RID: 3124 RVA: 0x003F36EC File Offset: 0x003F18EC
		public void Calculate(UIElement element)
		{
			this.BoundElement = element;
			CalculatedStyle dimensions = element.GetDimensions();
			this._calculatedPosition = dimensions.Position() + this._offset + this._anchor * new Vector2(dimensions.Width, dimensions.Height);
		}

		// Token: 0x06000C35 RID: 3125 RVA: 0x0000C7C4 File Offset: 0x0000A9C4
		public override string ToString()
		{
			return string.Concat(new object[]
			{
				"Snap Point - ",
				this.Name,
				" ",
				this.ID
			});
		}

		// Token: 0x04001003 RID: 4099
		private Vector2 _anchor;

		// Token: 0x04001004 RID: 4100
		private Vector2 _offset;

		// Token: 0x04001005 RID: 4101
		private Vector2 _calculatedPosition;

		// Token: 0x04001006 RID: 4102
		private string _name;

		// Token: 0x04001007 RID: 4103
		private int _id;

		// Token: 0x04001008 RID: 4104
		public UIElement BoundElement;
	}
}
